package com.bbs.action;

import java.io.ByteArrayInputStream;


import com.bbs.util.ImgValiCodeUtil;
import com.opensymphony.xwork2.ActionContext;

public class ValiCodeAction extends BaseAction{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String d;
	private ByteArrayInputStream inputStream;
	// 页面上点击验证码图片时调这个方法
	public String getImgCode() {
		ImgValiCodeUtil rdnu = ImgValiCodeUtil.Instance();
		this.setInputStream(rdnu.getImage());// 取得带有随机字符串的图片
		ActionContext.getContext().getSession().put("random", rdnu.getString());
		// 取得随机字符串放入HttpSession
		return "img";
	}
	public ByteArrayInputStream getInputStream() {
		return inputStream;
	}
	public void setInputStream(ByteArrayInputStream inputStream) {
		this.inputStream = inputStream;
	}
	public String getD() {
		return d;
	}
	public void setD(String d) {
		this.d = d;
	}

}